package com.atguigu.wordcount.commonfriend;

import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;

import java.io.IOException;


/**
 * @ClassName MapperCF1
 * @DeScription MapperCF1
 * @Author 剧情再美终是戏
 * @Date 2019/11/20 17:15
 * @Version 1.0
 **/

// 输入 A:B,C,D,F,E,O
// 输出 B:A C:A D:A
public class MapperCF1 extends Mapper<Text, Text, Text, Text> {

    private Text out_key = new Text();

    @Override
    protected void map(Text key, Text value, Context context) throws IOException, InterruptedException {
        String[] split = value.toString().split(",");
        for (String str : split) {
            out_key.set(str);
            context.write(out_key, key);
        }
    }
}
